<?php
/**
 * Created by 无所谓已
 * User: Administrator
 * Date: 2025-08-17
 * Time: 21:08
 */

namespace plugin\csauto\app\service;


use plugin\csauto\app\model\DownloaderModel;
use plugin\csauto\app\utils\QBittorrentClient;

class QBittorrentService
{
    public static function createService($id)
    {
        $model = DownloaderModel::where('id', $id)->first();
        if ($model) {
            $qb = new QBittorrentClient('http://' . $model->d_host, $model->d_port, $model->d_username, $model->d_password);
            return $qb;
        }
        return false;
    }

    public static function checkService($request)
    {
        $qb = new QBittorrentClient('http://' . $request->input('d_host'), $request->input('d_port'), $request->input('d_username'), $request->input('d_password'));
        return $qb;
    }

}